package com.kexio.enterprise.integration.event.history;

import com.kexio.enterprise.integration.event.domain.Event;
import com.kexio.enterprise.integration.event.enums.EventStatus;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * 事件历史记录
 * 
 * @author Kexio
 * @since 1.0.0
 */
public class EventHistory {
    private String historyId;
    private String eventId;
    private String eventType;
    private EventStatus status;
    private Event originalEvent;
    private List<String> processedBy; // 处理过此事件的处理器列表
    private Map<String, Object> processingResults; // 各处理器的处理结果
    private LocalDateTime createTime;
    private LocalDateTime lastUpdateTime;
    private int retryCount;
    private String lastError;

    public EventHistory() {
        this.historyId = java.util.UUID.randomUUID().toString();
        this.createTime = LocalDateTime.now();
        this.lastUpdateTime = LocalDateTime.now();
        this.retryCount = 0;
    }

    // Getters and Setters
    public String getHistoryId() { return historyId; }
    public void setHistoryId(String historyId) { this.historyId = historyId; }
    
    public String getEventId() { return eventId; }
    public void setEventId(String eventId) { this.eventId = eventId; }
    
    public String getEventType() { return eventType; }
    public void setEventType(String eventType) { this.eventType = eventType; }
    
    public EventStatus getStatus() { return status; }
    public void setStatus(EventStatus status) { this.status = status; }
    
    public Event getOriginalEvent() { return originalEvent; }
    public void setOriginalEvent(Event originalEvent) { this.originalEvent = originalEvent; }
    
    public List<String> getProcessedBy() { return processedBy; }
    public void setProcessedBy(List<String> processedBy) { this.processedBy = processedBy; }
    
    public Map<String, Object> getProcessingResults() { return processingResults; }
    public void setProcessingResults(Map<String, Object> processingResults) { this.processingResults = processingResults; }
    
    public LocalDateTime getCreateTime() { return createTime; }
    public void setCreateTime(LocalDateTime createTime) { this.createTime = createTime; }
    
    public LocalDateTime getLastUpdateTime() { return lastUpdateTime; }
    public void setLastUpdateTime(LocalDateTime lastUpdateTime) { this.lastUpdateTime = lastUpdateTime; }
    
    public int getRetryCount() { return retryCount; }
    public void setRetryCount(int retryCount) { this.retryCount = retryCount; }
    
    public String getLastError() { return lastError; }
    public void setLastError(String lastError) { this.lastError = lastError; }
}
